<?php
/*
* Copyright (c) 2010 by Cediti
*
* You may distribute under the terms of either the GNU Lesser General
* Public License or the new BSD License, as specified in the README file.
*/
// created :    09/02/2010
// version :    02/04/2010

class Cmis_Client_Rest_Generic_Discovery extends Cmis_Client_Rest_Generic_Abstract implements Cmis_Services_Protocol_Discovery
{
	public function query(Cmis_Repository_Id $repositoryId, $statement, $searchAllVersions = false, $includeRelationships = null, $renditionFilter = null, $includeAllowableActions = false, $maxItems = null, $skipCount = null)
	{
		/* @var $cur Cmis_Repository_Info */
		$cur = $this->_getRepositoryInfo($repositoryId);
		$objectById = $cur->getTemplate('query');

		$params = array(
            'repositoryId'  => $repositoryId,
            'q' => $statement,
            'searchAllVersions' => $searchAllVersions,
            'includeRelationships'  => $includeRelationships,
            'renditionFilter'   => $renditionFilter,
            'includeAllowableActions'   => $includeAllowableActions,
            'maxItems'  => $maxItems,
            'skipCount' => $skipCount,
		);

		$url = Cmis_ServiceUtils::urlTemplateParse($objectById['template'], $params);
//		$url = str_replace('+', ' ', $url);
//
//		Debug::var_debug($url);
//		echo '<a href="' . str_replace('+', ' ', $url) . '">test me</a>';
//		Debug::active();
		return $this->_callServices($url);
	}

	public function getContentChanges()
	{
		die('-[Must be implemented : ' . __METHOD__ . ' (' . __FILE__ . '#' . __LINE__ . ')]-');
	}
}

# EOF
